package com.yc.sole.system.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import jakarta.persistence.*;
import lombok.Data;

/**
 * @author yizuomin
 * @date 2024/3/6 16:56
 **/
@Data
@Entity
@Table(name = "sys_sequence", uniqueConstraints = {
        @UniqueConstraint(name = "un_seqCode_prefix", columnNames = {"sequenceCode", "prefix"})
})
@TableName(value = "sys_sequence", autoResultMap = true)
public class Sequence {

    /**
     * id
     */
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @TableId(type = IdType.AUTO)
    private Long id;
    /**
     * 序列规则编码
     */
    @Column(columnDefinition = "VARCHAR(50) NOT NULL COMMENT '序列编码'")
    private String sequenceCode;
    /**
     * 前缀
     */
    @Column(columnDefinition = "VARCHAR(20) COMMENT '前缀'")
    private String prefix;
    /**
     * 当前序列值
     */
    @Column(columnDefinition = "BIGINT NOT NULL DEFAULT 1 COMMENT '当前序列值'")
    private Long currentValue;
}
